<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('酒店列表')" />
</head>
<body class="gray-bg">
<div class="container-div">

    <div class="btn-group-sm" id="toolbar" role="group">
        <a class="btn btn-success" onclick="$.operate.add()">
            <i class="fa fa-plus"></i> 新增
        </a>
        <a class="btn btn-primary single disabled" onclick="$.operate.edit()">
            <i class="fa fa-edit"></i> 修改
        </a>
        <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
            <i class="fa fa-remove"></i> 删除
        </a>
    </div>
    <div class="row">
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var prefix = ctx + "hotel";
    //var datas = [[${@dict.getType('sys_normal_disable')}]];

    $(function() {
        var options = {
            uniqueId: 'id',
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            showSearch: false,
            showRefresh: true,
            showToggle: false,
            showColumns: false,
            search: false,
            modalName: "用户",
            columns: [{
                checkbox: true
            },
                {
                    field : 'name',
                    title : '酒店名称'
                },
                {
                    field : 'telephone',
                    title : '联系电话'
                },
                {
                    field : 'description',
                    title : '酒店简介'
                },
                {
                    field : 'address',
                    title : '酒店地址'
                }
                ,
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a href="javascript:void(0)" onclick="roomType(\'' + row.id + '\',\'' + row.name + '\')">房型管理</a> ');
                        actions.push('<a href="javascript:void(0)" onclick="roomDetail(\'' + row.id + '\',\'' + row.name + '\')">房间管理</a> ');
                        return actions.join('');
                    }
                }
                ]
        };
        $.table.init(options);
    });

    function roomType(hotelId, hotelName){
        var url = prefix + '/room/type?hotelId=' + hotelId;
        $.modal.openTab(hotelName + "房型", url);
    }

    function roomDetail(hotelId, hotelName){
        var url = prefix + '/room/detail?hotelId=' + hotelId;
        $.modal.openTab(hotelName + "房间", url);
    }
</script>
</body>
</html>